#!/usr/bin/env python
# -*- coding: UTF-8 -*-

'''
Created on 2010-9-24

@author: tanfeng
'''

import MySQLdb

class DBConnection(object):
    '''
    classdocs
    '''


    def __init__(self, host='172.16.0.8', user='db_admin', passwd='light2902', db='test'):
        '''
        Constructor
        '''
        
        host = host
        user = user
        password = passwd
        database = db
        port = 3306
        charset='utf8'
        
        self.conn = MySQLdb.connect(host=host, user=user, passwd=password, db=database, port=port, charset=charset)
        self.cur = self.conn.cursor()
        print "Connect Host: %s, Database: %s " % ( host, db)
    
    def destory(self):
        '''
        destory connection
        '''
        
        self.cur.close()
        self.conn.close()
        